const express = require('express');
const router = express.Router();
const { 
    getAllCarousels, 
    getCarouselDetail, 
    getImage, 
    createCarousel, 
    updateCarousel, 
    deleteCarousel, 
    handleFileUpload,
    uploadImage 
} = require('../controllers/carouselController');

// 所有路由暂时移除权限验证
router.get('/', getAllCarousels);
router.get('/:id', getCarouselDetail);
router.get('/:id/image', getImage);

// 图片上传路由
router.post('/upload', handleFileUpload, uploadImage);

// 轮播图管理路由
router.post('/', createCarousel);
router.put('/:id', handleFileUpload, updateCarousel);
router.delete('/:id', deleteCarousel);

module.exports = router;